<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../../../layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="../../../../layuiadmin/style/admin.css" media="all">
		<link rel="stylesheet" href="../../../../css/common.css" media="all">
	</head>

	<body>
		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">

						<div class="layui-card-body">
							<!-- 搜索 -->
							<form class="layui-form search" id="form" onsubmit="return false" action="##">

								<div class="layui-inline search_inline">
									<label class="layui-form-label">社区编号：</label>
									<div class="layui-input-inline">
										<input class="layui-input" lay-verify="" placeholder="社区编号" name="teamid" id="teamid" autocomplete="off">
									</div>
								</div>
								<div class="layui-inline search_inline">
									<label class="layui-form-label">会员编号：</label>
									<div class="layui-input-inline">
										<input class="layui-input" lay-verify="" placeholder="会员编号" name="customerid" id="customerid" autocomplete="off">
									</div>
								</div>

								<div class="layui-inline search_inline">
									<label class="layui-form-label">姓名/手机号：</label>
									<div class="layui-input-inline">
										<input class="layui-input" lay-verify="keyword" placeholder="姓名、手机号" name="keyword" autocomplete="off">
									</div>
								</div>
								
								<button class="layui-btn search_inline" lay-submit="" lay-filter="search" data-type="reload">搜索</button>
								<button class="layui-btn layui-btn-primary search_inline" type="reset">重置</button>
							</form>
							<!-- 搜索 -->
							
							<script type="text/html" id="test-table-operate-barDemo1"> 
								{{# if(d.status != 1){ }}
									<a class="layui-btn layui-btn-default layui-btn-xs" lay-event="audit">审核</a>
								{{# } }}
								{{# if(d.member){ }}
									{{# if(d.member[0].type == 0 && d.status == -1){ }}
										<a class="layui-btn layui-btn-default layui-btn-xs" lay-event="enable">启用</a>
									{{# } }}
									{{# if(d.member[0].type == 2 && d.status == 1){ }}
										<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">停用</a>
									{{# } }}
								{{# }  }} 
							</script>
							
							
							<div class="layui-row layui-col-space15">
								<table class="layui-hide" id="test-table-operate" lay-filter="test-table-operate"></table>
							</div>

							<div class="layui-form-item layui-layout-admin">
								<div class="layui-input-block">
									<div class="layui-footer test-table-operate-btn" style="left: 0;">
										<button class="layui-btn" data-type='getCheckData' id="queding">确定</button>
									</div>
								</div>
							</div>

						</div>
					</div>
				</div>
			</div>
		</div>

		<script src="../../../../layuiadmin/layui/layui.js"></script>
		<script src="../../../../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../../../js/common.js"></script>
		<script>
			layui.config({
				base: '../../../../layuiadmin/' //静态资源所在路径
			}).extend({
				index: 'lib/index' //主入口模块
			}).use(['index', 'table', 'form', 'layer'], function() {
				var table = layui.table,
					$ = layui.$,
					form = layui.form,
					layer = layui.layer,
					admin = layui.admin;

				var _data = {}

				initdata();

				goods_status_show('option');

				function initdata() {
					table.render({
						elem: '#test-table-operate',
						url: server.member_team_query,
						height: height_105,
						cellMinWidth: cellMinWidth,
						limit: limit,
						limits: limits,
						cols: [
							[{
								width: 50,
								field: 'zizeng',
								title: '#',
								fixed: 'left',
								templet: '#zizeng'
							}, {
								type: 'radio',
								fixed: 'left'
							},{
									field: 'id',
									title: '社区编号',
									sort: true									
								},{
									field: 'memberid',
									title: '会员编号',
									sort: true									
								}, {
									field: 'name',
									width: 180,
									title: '姓名'
								}, {
									field: 'sex',
									title: '性别',
									templet: function(d) {
										return d.sex ? sex_show(1, d.sex) : ''
									}
								}, {
									field: 'mobile',
									title: '手机号码'
								}, {
									field: 'community_name',
									title: '社区名称'
								}, {
									field: 'area_name',
									title: '地区名称'
								}, {
									field: 'address',
									title: '详细地址'
								},
								/*{
											field: 'vip',
											title: '是否会员',
											width: 130,
											templet: function(d) {
												if(d.vip==0){
													//return vip_show(1, d.vip) + '<button type="button" class="layui-btn layui-btn-primary layui-btn-xs>'+'开通'+'</button>';
													return vip_show(1, d.vip) + '&nbsp;&nbsp;&nbsp;&nbsp;<button class="layui-btn layui-btn-xs" lay-event="dredge">'+'开通'+'</button>'
												}else{
													return String(d.vip) ? vip_show(1, d.vip) : ''
												}
											}
										}, */
								{
									field: 'add_by',
									title: '创建人',
								}, {
									field: 'addtime',
									title: '创建时间',
								}, {
									field: 'edit_by',
									title: '更新人',
								}, {
									field: 'edittime',
									title: '更新时间',
								}]
						],
						page: true,
						where: _data,
						request: {
							pageName: 'page',
							limitName: 'size',
						},
						parseData: function(res) { //将原始数据解析成 table 组件所规定的数据
							return {
								"code": res.code, //解析接口状态
								"msg": res.msg, //解析提示文本
								"count": res.member_team.pager.total, //解析数据长度
								"data": res.member_team.data //解析数据列表
							};
						}
					});
				}
			
				//监听表格复选框选择
				table.on('checkbox(test-table-operate)', function(obj) {});
				//监听表格复选框选择
				table.on('radio(test-table-operate)', function(obj) {
					console.log(obj)
					_data = obj.data
				});
				$('#queding').on('click',function(){
					var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
					parent.$('input[name=team_name]').val(_data.name);
					parent.$('input[name=team_id]').val(_data.id);
					parent.layer.close(index); //再执行关闭
				});
				//监听搜索
				form.on('submit(search)', function(data) {
					_data = data.field
					initdata();
					return false;
				}); 
			});
		</script>
	</body>

</html>